//
//  BPUIBaseNavigationView.m
//  AFNetworking
//
//  Created by 404 on 2020/7/31.
//

#import "BPUIBaseNavigationView.h"


@implementation BPUIBaseNavigationView

- (instancetype)init{
    self = [super initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SafeAreaTopConstant)];
    if (self) {
        [self didInitialize];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self didInitialize];
    }
    return self;
}

- (void)didInitialize {
    self.backgroundColor = [UIColor whiteColor];
    _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 44)];
    [self addSubview:_backgroundView];
    _backgroundView.frame = CGRectMake(CGRectGetMinX(self.backgroundView.frame), STATUS_HEIGHT, CGRectGetWidth(self.backgroundView.frame), CGRectGetHeight(self.backgroundView.frame));
    
    _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 0, SCREEN_WIDTH - 60 * 2 , 44)];
    _titleLabel.font = UIFontMake(16);
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    [_backgroundView addSubview:_titleLabel];
    _shadow = [[UIView alloc] initWithFrame:CGRectMake(0, 43, SCREEN_WIDTH, 0.5)];
    
    _shadow.backgroundColor = [UIColor lightGrayColor];
    _shadow.alpha = .3;
    [_backgroundView addSubview:_shadow];
}

- (void)setTitle:(NSString *)title{
    _title = title;
    self.titleLabel.text = _title;
}

- (void)setTitleLabelFont:(UIFont *)titleLabelFont{
    _titleLabelFont = titleLabelFont;
    self.titleLabel.font = titleLabelFont;
}

-(void)setTintColor:(UIColor *)tintColor{
    _tintColor = tintColor;
    self.titleLabel.textColor = tintColor;
}

@end
